*******************************************************************************
*** Description: 	This document provides the code for preparing Version 	***
***					11 of the Varieties of Democracy (V-Dem) data for use 	*** 
***					in thereplication of "Compulsory Voting Diminishes the	***
***					Relationship Between Winning and Satisfaction with 		***
***					Democracy," which is authored by Shane P. Singh and		***
***					and appears in the Journal of Politics.					***
*******************************************************************************



**************
**************
*Set the Version                                                                                                                         
**************
**************
version 17.0


**************
**************
*Open the Varieties of Democracy Version 11 Data                                                                                                                         
**************
**************
use "V-Dem-CY-Full+Others-v11", clear



**************
**************
*Rename Some Countries and Create Variables That Identify Country-Years to Help with Merging
**************
**************
gen country = country_name 
replace country = "Cote d'Ivoire" if country == "Ivory Coast"
replace country = "Myanmar" if country == "Burma/Myanmar"
replace country = "North Korea" if country == "Korea_North"
replace country = "South Korea" if country == "Korea_South"
replace country = "Vietnam" if country == "Democratic Republic of Vietnam"
replace country = "Congo (DRC)" if country == "Democratic Republic of Congo"
replace country = "Congo" if country == "Congo_Republic of the"
replace country = "Congo" if country == "Republic of the Congo"
replace country = "Trinidad & Tobago" if country == "Trinidad and Tobago"
replace country = "Timor-Leste" if country == "East Timor"
replace country =  "Sao Tome and Principe" if country == "São Tomé och Príncipe"
replace country = "United States" if country == "United States of America"

tostring year, replace
gen countryandyear = country+"_"+year
destring year, replace

label var country "country"



**************
************** 
*Save the Data
**************
**************  
save "V-Dem_JOP_Replication.dta", replace
